package org.anderground.editor.gui.toolbar;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JToggleButton;
import javax.swing.JToolBar;

import org.anderground.editor.gui.view.standard.ViewTriggers;

public class SelectionToolBar extends JToolBar {

	public SelectionToolBar() {
		add(new TunnelSelectionButton());
		add(new StationSelectionButton());
	}

	class TunnelSelectionButton extends JToggleButton {
		public TunnelSelectionButton() {
			super("Select tunnels");
			this.setSelected(true);
			setFocusable(false);
			addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					ViewTriggers.tunnelSelectingEnabled = TunnelSelectionButton.this
							.isSelected();

				}

			});
		}
	}

	class StationSelectionButton extends JToggleButton {
		public StationSelectionButton() {
			super("Select stations");
			this.setSelected(true);
			setFocusable(false);
			addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					ViewTriggers.stationSelectingEnabled = StationSelectionButton.this
							.isSelected();

				}

			});
		}
	}
}
